#ifndef _COMMONDEF_H_
#define _COMMONDEF_H_

//////////////////////////////////////////////////////////////////////////
//!
//!	\file 		commondef.h
//!	\date 		Sep 4, 2009
//!	\author		Terence Wu
//!	
//!	\brief		Contains common defintion used in fft-gpu library.
//!             Ported from AMD-SPL code.
//!
//////////////////////////////////////////////////////////////////////////
#define _CRT_NONSTDC_NO_DEPRECATE
#include "stdio.h"
#include "stdlib.h"
#include "assert.h"

//! \brief Define NULL pointer value
#ifndef NULL
#ifdef __cplusplus
#define NULL    0
#else
#define NULL    ((void *)0)
#endif
#endif

//! \brief	Defines safe delete macro.
#define SAFE_DELETE(ptr) \
    if ((ptr) != NULL) \
{ \
    delete ptr; \
    ptr = NULL; \
}

//! \brief	Defines error log macro. Output to standard error stream.
#define LOG_ERROR(msg) \
{ \
    fprintf(stderr, (msg)); \
}

//! \brief	Defines trace log macro. Output to standard output stream.
#define LOG_TRACE(msg) \
{\
    fprintf(stdout, (msg)); \
}

#define ASSERT(e) assert(e)

#define FFTGPU_EXPORT __declspec(dllexport)

#define DIVIDES(a, b) (((b) % (a)) == 0)

#endif //_COMMONDEF_H_
